package com.atguigu05.method_more._03valuetransfer;

/**
 * ClassName: ValueTransferTest
 * Description:
 *
 * @Author 尚硅谷-宋红康
 * @Create 8:48
 * @Version 1.0
 */
public class ValueTransferTest {
    public static void main(String[] args) {
        //1. 基本数据类型的局部变量
        int m = 10, n;
        n = m;//数值传递

        m++;
        System.out.println("m = " + m + ",n = " + n);


        //2. 引用数据类型的局部变量
        //2.1 数组类型
        int[] arr1 = new int[]{1, 2, 3, 4};
        int[] arr2 = arr1;
        System.out.println("arr1=" + arr1 + ",arr2=" + arr2);//传送地址值

        arr2[1] = 100;
        System.out.println(arr1[1]);//100


        //2.2 对象类型

        order add = new order();
        add.age = 1;
        order add1 = add;
        System.out.println("add=" + add + ",add1=" + add1);//地址

        add.age = 10;
        System.out.println(add1.age);


    }
}
class order{
    int age;
}



